# coding: utf-8

import gtk
import hildon
from gamelist import GameList
from gameswindow import GamesWindow

class MainWindow(hildon.StackableWindow):
	def __init__(self, app):
		hildon.StackableWindow.__init__(self)
		
		self.connect("delete-event", gtk.main_quit)
	
		self.app = app
		
		self.set_title ("Chessmonk")
		
		align = gtk.Alignment(0, 0, 1.0, 1.0)
		align.set_padding(4, 0, 16, 16)
		self.add(align)
		
		box = gtk.VBox()
		align.add(box)
		
		button = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
		button.set_label("Open new PGN file")
		button.connect("clicked", self.file_button_clicked_event)
		box.pack_start(button, False, False, 0)
		
		pan = hildon.PannableArea()
		box.pack_start(pan)
		
		gamelist = GameList(self)
		pan.add(gamelist)
		
	def file_button_clicked_event(self, data):
		#filechooser = gtk.FileChooserDialog()
		#filechooser.run()
		
		gameswindow = GamesWindow()
		
		
